import java.io.File;
import java.io.IOException;
import java.util.List;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;

/** 
 * 
 * @author
 * @version 2014/03/09
 */
public class ReadXMLFile {

  /** */
  public static void main(String[] args) {

    SAXBuilder builder = new SAXBuilder();
    File xmlFile = new File("data.xml");

    try {

      Document document = (Document) builder.build(xmlFile);
      Element rootNode = document.getRootElement();
      List<Element> list = rootNode.getChildren("UserID");

      for (int i = 0; i < list.size(); i++) {

        Element node = (Element) list.get(i);

        System.out.println("User ID: " + node.getAttributeValue("id"));
        System.out.println("First Name : " + node.getChildText("FirstName"));
        System.out.println("Last Name : " + node.getChildText("LastName"));
        System.out.println("Email : " + node.getChildText("email"));
        System.out.println("Conference ID : " + node.getChildText("ConferenceID"));
        System.out.println("Conference Title : " + node.getChildText("ConferenceTitle"));
        System.out.println("Conference Description : "
                           + node.getChildText("ConferenceDescription"));
        System.out.println("Role ID : " + node.getChildText("RoleID"));
        System.out.println("Role : " + node.getChildText("Role"));

      }

    } catch (IOException io) {
      System.out.println(io.getMessage());
    } catch (JDOMException jdomex) {
      System.out.println(jdomex.getMessage());
    }
  }
}
